import {request} from "./request"
import {formatDate} from "utils/data"
// 歌曲详情
export function _getSongsDetail(id){
    return request({
        url:'/song/detail',
       params:{
           ids:id
       }
    })
}
export function _getMusicListDetail(id){
    return request({
        url:'/playlist/detail',
        params:{
            id:id
        }
    })
}
// 发送评论
export function _postComment(params){
    return request({
        url:'/comment',
        params
    })
}
export function _getComment(params){
    return request({
        url:'/comment/playlist',
        params
    })
}
// 收藏
export function _getSubscribers(params){
    return request({
        url:'/playlist/subscribers',
        params
    })
}
// 获取音乐url
// 
export function _getSongUrl(params){
    return request({
        url:'/song/url',
        params
    })
}
/**获取歌词 */
export function _getLyric(id){
    return request ({
        url:'/lyric',
        params:{
            id:id
        }
    })
}
/**获取歌曲评论 */
export function _getMusicComment(params){
    return request ({
        url:'/comment/music',
        params
    })
}

/**对歌曲数据进行封装 */
export class songDetail{
    constructor(songs){
        this.id=songs[0].id;
        this.name=songs[0].name;
        this.album=songs[0].al.name;
        this.artist=songs[0].ar[0].name;
        this.pic=songs[0].al.picUrl;
        this.time=formatDate(new Date(songs[0].dt),'mm:ss')
    }
}